#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec  3 15:11:49 2023

@author: liqingsimac
"""

#'''
########################################################
##Final-A-10
import numpy as np
import matplotlib.pyplot as plt

m=2
x=np.linspace(-m,m,15)
y=np.linspace(-m,m,15)
[X,Y] = np.meshgrid(x,y)

B=np.array([1,0,0,2]).reshape(2,2)
P=np.array([1,2,2,3]).reshape(2,2)
A=P@B@np.linalg.inv(P)
[[a,b],[c,d]]=A

U=a*X+b*Y
V=c*X+d*Y
C=(X**2+Y**2)/np.max(X**2+Y**2)

fig, ax = plt.subplots()
ax.quiver(X,Y,U,V,C)
ax.set_xticks([])
ax.set_yticks([])
ax.set_aspect('equal')
       
t=np.linspace(-3,3,51)
#C1=[-4,-2,-1,0,2,5]
#C2=[-4,-2,-1,0,2,5]
C1=[-2,-1,0,1,2]
C2=[-2,-1,0,1,2]
for k1 in range(len(C1)):
    for k2 in range(len(C2)):
        xg=C1[k1]*np.exp(t)+2*C2[k2]*np.exp(2*t)
        yg=2*C1[k1]*np.exp(t)+3*C2[k2]*np.exp(2*t)
        ax.plot(xg,yg,'-')
ax.set_xlim(-m,m)
ax.set_ylim(-m,m)
########################################################
#'''


